<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 系统角色
 */
class CreateSysRoleTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sys_roles', function (Blueprint $table) {
            $table->increments('role_id');
            $table->integer('parent_id')->default(0)->comment('父级角色ID');
            $table->string('name', 50)->unique()->default('')->comment('角色定义名');
            $table->string('display_name',  50)->default('')->comment('角色显示名');
            $table->text('description')->comment('角色描述');
            $table->unsignedSmallInteger('order_num')->default(0)->comment('排序数字，值越小越靠前');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sys_roles');
    }
}
